**************************************
*generated: 2023-11 -- Subgroup regression analysis
*
*by Lukas Rudolph
*
*
*Data used:  df_clean.dta
*Tables generated: Table 1; Supplementary Matarial Tables S.3 - S.8
**************************************


********************************************************
*prep stata
********************************************************

* install package estout by Benn Jann via "findit estout", if not already installed

********************************************************
*output directories
********************************************************

*set your directory path

/*

cd "path to folder containing the folder "data" with the dataset"

global tab = "path to table folder" // e.g.: global tab = "tabs" ; then set up empty folder "tabs" in folder containing the do-file with cd set there

*/

********************************************************
*load data
********************************************************

use data/df_ordering.dta, clear


********************************************************
*recode
********************************************************

**coding demographic indicators

recode Household_Income (1/2 = 1 "Income < 1750") (3/4 = 2 "Income > 1750") (5/7 = 3 "Income > 3500"), gen(inc3cat)

recode Age (1/2 = 1 "Age <34") (3/4 = 2 "Age 35-54") (5/6 = 3 "Age > 54"), gen(age3cat)

gen edu_bin = 0
replace edu_bin = 1 if Q6_FR >= 5 & Q6_FR <= 7
replace edu_bin = 1 if Q6 >= 5 & Q6 <= 7

recode Gender (2=1 "Gender: female") (1=0 "Gender: male") (3=.a), gen(female)

**coding political attitude indicators

recode lr (1/5 = 1 "Ideology: left") (6 = 2 "Ideology: center") (6/11 = 3 "Ideology: right"), gen(leftcenterright)

egen deont = rowmax(Q15B1r? Q15B2r?)
recode deont (1/3 = 1) (4/7 = 0), gen(deontmax3)

**coding attentiveness indicators

recode Pol_Interest (1/2 = 1) (3/5 = 0), gen(highinterest)

recode Q20B (5/7=1) (1/4 = 0), gen(salience) 


** ordering treatment indicators

recode CJ_ATT_ORDERING (2=1) (1=0)

gen importantfirst = 1 if BLOCKORDERc3 == 1 | BLOCKORDERc1 == 1
replace importantfirst = 0 if importantfirst == .
replace importantfirst  = . if CJ_ATT_ORDERING == 1


** labelling 

label variable Q16r1 "Unsure in reply"
label variable Q16r2 "Easy to decide"
label variable Q16r4 "Table missed info"
label variable CJ_ATT_ORDERING "Block randomization"
label variable importantfirst "Econ. or norm. attr. shown first"
label variable deontmax3 "Rejectors"
label variable edu_bin "High education"
label variable   highinterest "High pol. interest"
label variable   salience "High issue salience"
label variable leftcenterright "leftright"
label variable female "female"
label variable vmobiledevice "Device used"
label define vmobiledevice 1 "Mobile" 3 "Tablet" 5 "Desktop"
label values vmobiledevice vmobiledevice

********************************************************
*self-reported replies -- block vs. full
********************************************************


********************************************************
*Main paper -- block vs. full
********************************************************

***attentiveness of respondents

eststo clear
qui foreach y in    highinterest salience /// 
{ //  

foreach x in 1 2 4 {
eststo: qui reg Q16r`x' i.CJ_ATT_ORDERING##i.`y' , r
}
}

esttab     using $tab\table_1.tex /// POQ format
,   p(3) nonote replace  noomitted nobaselevels  label nostar /// star(+ 0.1 * 0.05 ** 0.01)
mgroups("Political interest" "Issue saliency", pattern(1 0 0 1 0 0))


********************************************************
*APPENDIX - block vs. full
********************************************************

***demographics of respondents -- TableS3

eststo clear
qui foreach y in edu_bin female age3cat inc3cat  /// 
{ //  

foreach x in 1 2 4 {
eststo: qui reg Q16r`x' i.CJ_ATT_ORDERING##i.`y' , r
}
}

esttab    using $tab\table_S3.tex ///
,   p(3) nonote replace  noomitted nobaselevels  label nostar /// star(+ 0.1 * 0.05 ** 0.01)
mgroups("Education" "Gender" "Age" "Income", pattern(1 0 0 1 0 0 1 0 0 1 0 0))


***attitudes of respondents -- TableS4


eststo clear
qui foreach y in deontmax3  leftcenterright  /// opposed
{ //  

foreach x in 1 2 4 {
eststo: qui reg Q16r`x' i.CJ_ATT_ORDERING##i.`y' , r
}
}

esttab   using $tab\table_S4.tex ///
,   p(3) nonote replace  noomitted nobaselevels  label nostar /// star(+ 0.1 * 0.05 ** 0.01)
mgroups("Principled opposition" "Political ideology", pattern(1 0 0 1 0 0))



********************************************************
*APPENDIX - Important attributes first
********************************************************


***attentiveness of respondents -- TableS5

eststo clear
qui foreach y in    highinterest salience /// 
{ //  

foreach x in 1 2 4 {
eststo: qui reg Q16r`x' i.importantfirst##i.`y' , r
}
}

esttab    using $tab\table_S5.tex  ///
,   p(3) nonote replace  noomitted nobaselevels  label nostar /// star(+ 0.1 * 0.05 ** 0.01)
mgroups("Political interest" "Issue saliency", pattern(1 0 0 1 0 0))



***demographics of respondents -- TableS6

eststo clear
qui foreach y in  edu_bin female age3cat inc3cat  /// 
{ //  

foreach x in 1 2 4 {
eststo: qui reg Q16r`x' i.importantfirst##i.`y' , r
}
}

esttab    using $tab\table_S6.tex ///
,   p(3) nonote replace  noomitted nobaselevels  label nostar /// star(+ 0.1 * 0.05 ** 0.01)
mgroups("Education" "Gender" "Age" "Income", pattern(1 0 0 1 0 0 1 0 0 1 0 0))



***attitudes of respondents -- TableS7

eststo clear
qui foreach y in  deontmax3  leftcenterright  /// opposed
{ //  

foreach x in 1 2 4 {
eststo: qui reg Q16r`x' i.importantfirst##i.`y' , r
}
}

esttab    using $tab\table_S7.tex ///
,   p(3) nonote replace  noomitted nobaselevels  label nostar /// star(+ 0.1 * 0.05 ** 0.01)
mgroups("Principled opposition" "Political ideology", pattern(1 0 0 1 0 0))



********************************************************
*APPENDIX - mode of survey completion -- TableS8
********************************************************


eststo clear
foreach x in 1 2 4 {
eststo:  reg Q16r`x' i.CJ_ATT_ORDERING##i.vmobiledevice , r
}

esttab    using $tab\table_S8.tex ///
,   p(3) nonote replace  noomitted nobaselevels  label nostar /// star(+ 0.1 * 0.05 ** 0.01)
mgroups("Device used", pattern(1 0 0 1 0 0))


********************************************************
*END
********************************************************

